// 基于template/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{spinalCase ctrl.codeName}}-grid-model.ts.hbs生成
import { IGridModel, IParam, isEmpty, VerifyUtil } from '@/core';

function getModel(): IGridModel {
	return {
        cssName: "",        
		aggMode: 'NONE',
		caption: '',
		controlType: 'GRID',
		codeName: 'Main',      
		columns: getGridColumns(),
		dataItems: getGridDataItems(),
		dataExport: getDataExport(),
		enableRowEdit: false,
		entityCodeName: 'IBIZOrderDetail',
		entityLogicName: '订单明细',
		createDefaultItems: getCreateDefaultItems(),
        updateDefaultItems: getUpdateDefaultItems(),
		name: 'grid',
		noSort: false,
		rules: {
            //	静态值规则
            staticRules: {
		    },
            //	编辑项值规则
            editRules: [
			]
    	},
		showHeader: true,
		sortDir: '',
		sortField: '',
		limit: 10,
		paging: {
			defaultPageSize: 10,
		},
		ctrlMsgModel:[
    ],
		uiEngineModel: [
            {
                name: 'engine_grid',
                triggerType: 'CTRLEVENT',
                logicType: 'APPVIEWENGINE',
                eventNames: 'ROWDBLCLICK;SELECTIONCHANGE;REMOVE;LOAD;BEFORELOAD',
                scriptCode: ``,
                entityCodeName: '',
                logicName:``
            }
    ]
    }
}
//  获取所有表格列模型
function getGridColumns():IParam[] {
  return [
		{
			align: 'left',
			codeName: 'ibizorderdetailname',
			caption: '订单明细名称',
			captionLanResTag: 'DEF.LNAME.IBIZORDERDETAILNAME',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
		    valueType: "SIMPLE",
			dataItemName: 'ibizorderdetailname',
			dataIndex: 'ibizorderdetailname',
		    sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
		    filterName: '',
		    filterCodeListTag: '',
		    filterCodeListType: '',
			enableSort: true,
			excelCaption: '订单明细名称',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'ibizorderdetailname',
		    width: 150,
		    minWidth: 150,
		    resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'IBIZordername',
			caption: '订单名称',
			captionLanResTag: 'DEF.LNAME.IBIZORDERDETAIL.IBIZORDERNAME',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
		    valueType: "SIMPLE",
			dataItemName: 'ibizordername',
			dataIndex: 'ibizordername',
		    sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
		    filterName: '',
		    filterCodeListTag: '',
		    filterCodeListType: '',
			enableSort: true,
			excelCaption: '订单名称',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'IBIZordername',
		    width: 150,
		    minWidth: 150,
		    resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'IBIZuniproductname',
			caption: '产品名称',
			captionLanResTag: 'DEF.LNAME.IBIZORDERDETAIL.IBIZUNIPRODUCTNAME',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
		    valueType: "SIMPLE",
			dataItemName: 'ibizuniproductname',
			dataIndex: 'ibizuniproductname',
		    sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
		    filterName: '',
		    filterCodeListTag: '',
		    filterCodeListType: '',
			enableSort: true,
			excelCaption: '产品名称',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'IBIZuniproductname',
			linkView: 'IBIZUNIProductRedirectView',
			linkValueItem: 'ibizuniproductid',
			linkViewDeKeyField: 'ibizuniproduct',
		    minWidth: 150,
		    width: 150,
		    resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'quantity',
			caption: '数量',
			captionLanResTag: 'DEF.LNAME.QUANTITY',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
		    valueType: "SIMPLE",
			dataItemName: 'quantity',
			dataIndex: 'quantity',
		    sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
		    filterName: '',
		    filterCodeListTag: '',
		    filterCodeListType: '',
			enableSort: true,
			excelCaption: '数量',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'quantity',
		    minWidth: 150,
		    width: 150,
		    resizable: true,
			stdDataType: 9,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'unitprice',
			caption: '单价X',
			captionLanResTag: 'DEF.LNAME.UNITPRICE',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
		    valueType: "SIMPLE",
			dataItemName: 'unitprice',
			dataIndex: 'unitprice',
		    sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
		    filterName: '',
		    filterCodeListTag: '',
		    filterCodeListType: '',
			enableSort: true,
			excelCaption: '单价X',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'unitprice',
		    minWidth: 150,
		    width: 150,
		    resizable: true,
			stdDataType: 7,
			precision: 2,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'amount',
			caption: '小计',
			captionLanResTag: 'DEF.LNAME.AMOUNT',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
		    valueType: "SIMPLE",
			dataItemName: 'amount',
			dataIndex: 'amount',
		    sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
		    filterName: '',
		    filterCodeListTag: '',
		    filterCodeListType: '',
			enableSort: true,
			excelCaption: '小计',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'amount',
		    minWidth: 100,
		    width: 100,
		    resizable: true,
			stdDataType: 7,
			valueFormat: '',
		},
		{
			align: 'left',
			codeName: 'unit',
			caption: '单位',
			captionLanResTag: 'DEF.LNAME.UNIT',
			cellCssName: '',
			columnType: 'DEFGRIDCOLUMN',
		    valueType: "SIMPLE",
			dataItemName: 'unit',
			dataIndex: 'unit',
		    sorter: true,
			enableRowEdit: false,
			customFilterDropdown: false,
		    filterName: '',
		    filterCodeListTag: '',
		    filterCodeListType: '',
			enableSort: true,
			excelCaption: '单位',
			headerCssName: '',
			show: true,
			hiddenDataItem: false,
			name: 'unit',
		    width: 150,
		    minWidth: 150,
		    resizable: true,
			stdDataType: 25,
			valueFormat: '',
		},
  ];
}

//  获取所有表格数据项
function getGridDataItems() {
  return [
    {
			name: 'ibizorderdetailname',
			codeName: '',
            customCode: false,
			fieldCodeName: 'ibizorderdetailname',
			fieldName: 'ibizorderdetailname',
			valueFormat: '',
			dataType: '25'
    },
    {
			name: 'ibizordername',
			codeName: '',
            customCode: false,
			fieldCodeName: 'ibizordername',
			fieldName: 'ibizordername',
			valueFormat: '',
			dataType: '25'
    },
    {
			name: 'ibizuniproductname',
			codeName: '',
            customCode: false,
			fieldCodeName: 'ibizuniproductname',
			fieldName: 'ibizuniproductname',
			valueFormat: '',
			dataType: '25'
    },
    {
			name: 'quantity',
			codeName: '',
            customCode: false,
			fieldCodeName: 'quantity',
			fieldName: 'quantity',
			valueFormat: '',
			dataType: '9'
    },
    {
			name: 'unitprice',
			codeName: '',
            customCode: false,
			fieldCodeName: 'unitprice',
			fieldName: 'unitprice',
			valueFormat: '',
			dataType: '7'
    },
    {
			name: 'amount',
			codeName: '',
            customCode: false,
			fieldCodeName: 'amount',
			fieldName: 'amount',
			valueFormat: '',
			dataType: '7'
    },
    {
			name: 'unit',
			codeName: '',
            customCode: false,
			fieldCodeName: 'unit',
			fieldName: 'unit',
			valueFormat: '',
			dataType: '25'
    },
    {
			name: 'ibizorderdetailid',
			codeName: '',
            customCode: false,
			fieldCodeName: 'ibizorderdetailid',
			fieldName: 'ibizorderdetailid',
			valueFormat: '',
			dataType: '25'
    },
    {
			name: 'srfkey',
			codeName: '',
            customCode: false,
			fieldCodeName: 'ibizorderdetailid',
			fieldName: 'ibizorderdetailid',
			valueFormat: '',
			dataType: '25'
    },
    {
			name: 'srfdataaccaction',
			codeName: '',
            customCode: false,
			fieldCodeName: 'ibizorderdetailid',
			fieldName: 'ibizorderdetailid',
			valueFormat: '',
			dataType: '25'
    },
    {
			name: 'ibizorderid',
			codeName: '',
            customCode: false,
			fieldCodeName: 'ibizorderid',
			fieldName: 'ibizorderid',
			valueFormat: '',
			dataType: '25'
    },
    {
			name: 'ibizuniproductid',
			codeName: '',
            customCode: false,
			fieldCodeName: 'ibizuniproductid',
			fieldName: 'ibizuniproductid',
			valueFormat: '',
			dataType: '25'
    },
    {
			name: 'srfmajortext',
			codeName: '',
            customCode: false,
			fieldCodeName: 'ibizorderdetailname',
			fieldName: 'ibizorderdetailname',
			valueFormat: '',
			dataType: '25'
    },
  ];
}

function getDataExport() {
	return {
        default: true,
		codeName: 'default',
		enableFront: true,
		fileName: '订单明细',
		exportItems: [
			{
				name: 'ibizorderdetailname',
				label: '订单明细名称',
  				labelLanResTag: 'DEF.LNAME.IBIZORDERDETAILNAME',
				dataType: 25,
				show: true
			},
			{
				name: 'ibizordername',
				label: '订单名称',
  				labelLanResTag: 'DEF.LNAME.IBIZORDERDETAIL.IBIZORDERNAME',
				dataType: 25,
				show: true
			},
			{
				name: 'ibizuniproductname',
				label: '产品名称',
  				labelLanResTag: 'DEF.LNAME.IBIZORDERDETAIL.IBIZUNIPRODUCTNAME',
				dataType: 25,
				show: true
			},
			{
				name: 'quantity',
				label: '数量',
  				labelLanResTag: 'DEF.LNAME.QUANTITY',
				dataType: 9,
				show: true
			},
			{
				name: 'unitprice',
				label: '单价X',
  				labelLanResTag: 'DEF.LNAME.UNITPRICE',
				dataType: 7,
				show: true
			},
			{
				name: 'amount',
				label: '小计',
  				labelLanResTag: 'DEF.LNAME.AMOUNT',
				dataType: 7,
				show: true
			},
			{
				name: 'unit',
				label: '单位',
  				labelLanResTag: 'DEF.LNAME.UNIT',
				dataType: 25,
				show: true
			}
		]
	}
}

function getCreateDefaultItems() {
	return [
	]
}

function getUpdateDefaultItems() {
	return [
	];
}

export const model = getModel();